/**
 * User: Anton Petrov
 * Date: 3/10/13
 * Time: 6:59 PM
 */
package com.antonpetrov.model.word
{
	/**
	 * A basic word contains of a single word and an explanation.
	 * E.g., "cat - an animal with a furry tail and whiskers."
	 */
	public class BasicWord
	{
		public var word:String;
		public var explanation:String;

		public function BasicWord(word:String, explanation:String="")
		{
			if (word == null || word.length == 0)
			{
				throw new Error(
					"Cannot create a BasicWord with a null or 0-length word input.");
			}

			this.word = word;
			this.explanation = explanation;
		}

		public function toString():String
		{
			var wordExplanation:String = explanation;
			if (explanation == "")
			{
				wordExplanation = "((explanation missing))"
			}
			return word + ": " + wordExplanation;
		}
	}
}
